/*
 * @Author: 老刘
 * @Date: 2020-04-29 15:51:38
 * @Description: 海报
 */
const { wxml, style } = require('./demo.js');
Page({
	data: {
		src: ''
	},
	onReady () {
		this.widget = this.selectComponent('.widget');
	},
	renderToCanvas () {
		const p1 = this.widget.renderToCanvas({ wxml, style });
		p1.then((res) => {
			console.log(res);
			console.log('container', res.layoutBox);
			this.container = res;
		});
	},
	extraImage () {
		const p2 = this.widget.canvasToTempFilePath();
		p2.then(res => {
			this.setData({
				src: res.tempFilePath,
				width: this.container.layoutBox.width,
				height: this.container.layoutBox.height
			});
		});
	}
});
